{% load i18n %}
{% load extras %}
<div>
<hr class="firstpost" />
{% with result.object_list as posts %}
{% for post in posts %}
    <div id="snap_post{{ post.id }}">

        {% if post.censor %}
            <div class="post_censored">
        {% else %}
            {% ifnotequal post.abuse 0 %}
                <div class="post_reported">
            {% endifnotequal %}
        {% endif %}

        <div id="post_rpc_feedback{{ post.id }}" class="rpc_message">
            <!-- This DIV is for RPC feedback messages for individual posts -->
        </div>
        <p class="post_header">
            <span class="post_menuright">
                {% if user.is_authenticated  %}
                <span class="popup">
                    <a href="#post_form" onclick="return do_quote('{{ post.id }}');">{% trans "quote" %}</a>
                </span>
                {% endif %}
                {% ifequal post.user_id user.id %}
                &#149;
                <span title="{% trans "Edit this post.  All revisions are saved!" %}" class="popup">
                    <a href="#snap_post{{ post.id }}" onclick="toggle_edit('{{ post.id }}')">{% trans "edit post" %}</a>
                </span>
                {% endifequal %}
                {% if user.is_staff %}
                &#149;
                <span title="{% trans "ADMIN: mark this post for censorship" %}" class="popup">
                    <a id="censor{{ post.id }}" href="#snap_post{{ post.id }}" onclick="set_censor('{{ post.id }}');">
                        {{ post.censor|yesno:_("uncensor,censor") }}
                    </a>
                </span>
                {% endif %}
                {% if user.is_authenticated and not post.freespeech %}
                &#149;
                <span title="{% trans "Report this post for violation of forum policies." %}" class="popup">
                    <a id="abuse{{ post.id }}" href="#snap_post{{ post.id }}" onclick="set_abuse('{{ post.id }}');">{% trans "report abuse" %}</a>
                </span>
                {% endif %}
            </span>

            {% if post.avatar %}
                <img src="{{ SNAP_MEDIA_PREFIX }}/{{ post.avatar }}" />
            {% endif %}
            <b>
                <a href="#snap_post{{ post.id }}" onclick="toggle_post('{{ post.id }}');">
                    <span class="popup" title="Author">{{ post.user }}</span>
                </a>
            </b>

            {% if post.private.all %}
                {% trans "to" %} {% for rec in post.private.all %}
                {{ rec }}{% if not forloop.last %},{% endif %}
                {% endfor %}
            {% endif %}

            <span class="timesince">
                <span class="datetime">{{ post.date|date:"r T" }}<span class="timestamp">{{ post.date|timestamp }}</span></span>
            </span>
            <span class="post_summary" style="display:none;" id="snap_post_sum{{ post.id }}">:
                {{ post.text|post_summary:"30"|safe }}
            </span>
        </p>

        <div style="display:block" id="snap_post_view{{ post.id }}">
            <div class="post_text" style="display:block" id="snap_post_text{{ post.id }}">
                {{ post.text|striptags|render_post|safe }}
            </div>
            {% if post.previous %}
            <span id="post_revision_links{{ post.id }}" class="post_menuleft">
                <a href="#snap_post_view{{ post.id }}" onclick="revision('{{ post.id }}','{{ post.previous.id }}');">&#171; {% trans "previous" %}</a>
                <b style="color: #c00">{% trans "This message has been revised" %}</b>
            </span>


            <br />
            {% endif %}

            {% ifequal post.user_id user.id %}
            <div style="display:none" id="snap_post_edit{{ post.id }}">
                <form action="/bbs/edit_post/{{post.id}}/" method="post">
                <p><b>{% trans "All revisions of this post are stored and publicly viewable." %}</b></p>
                <p>{{ post.get_edit_form.post }} {# TODO: what about errors? #}</p>
                <p>
                <input type="submit" value="{% trans "Update" %}" />
                <input type="hidden" name="next" value="{{ request.path }}" />
                </p>
                </form>
            </div>
            {% endifequal %}
            <br />
        </div>

        {% if post.censor %}
            </div>
        {% else %}
            {% ifnotequal post.abuse 0 %}
                </div>
            {% endifnotequal %}
        {% endif %}
    </div>
    <hr class="postend" />
{% endfor %} {# iterate through posts #}
{% endwith %}
</div>
<!--
vim: ai ts=4 sts=4 et sw=4
-->
